import java.util.Scanner;
public class P1425 {
    public static void main(String args[]){
        int start_hour,start_minute,end_hour,end_minute;
        int result_hour,result_minute;
        Scanner input = new Scanner(System.in);
        start_hour = input.nextInt();
        start_minute = input.nextInt();
        end_hour = input.nextInt();
        end_minute = input.nextInt();
        result_hour = end_hour - (start_hour + 1);
        result_minute = (60 - start_minute) +  end_minute;
        result_hour += result_minute / 60;
        result_minute %= 60;
        System.out.println(result_hour + " " + result_minute);
    }
}
